home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Code Resources / SliderCDEF 1.0 / SliderCDEF Source ƒ / SliderCalcCRgns.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-10  |  996 b   |  32 lines  |  [TEXT/KAHL]

  1. #include "SliderCDEF.h"
  2.  
  3. #define kPartMask    0xF0000000
  4.  
  5. // SliderCalcCRgns
  6. //
  7. // Calculates either the entire control's region which is just the control rectangle for
  8. // the slider control or the indicator's region, depending on the high bit of param.
  9. // Note: the calcCRgns message is only sent by the control manager when running
  10. // in 24-bit mode. Under 32-bit mode, two messages are sent: one for the entire
  11. // control (calcCntlRgn), and one for the indicator (calcThumbRgn).
  12. void SliderCalcCRgns( short varCode, ControlHandle theControl, long param )
  13. {
  14.     Boolean    isIndicator;
  15.     Rect        thumbRect;
  16.             
  17.     // Test the high bit of param
  18.     isIndicator = param & kPartMask;
  19.     if ( isIndicator ) {
  20.         // Clear the high-order bit;
  21.         param = param | kPartMask;
  22.         
  23.         thumbRect = CalcThumbRect( theControl );
  24.         RectRgn( (RgnHandle) param, &thumbRect );
  25.     } else {
  26.         HLock( (Handle) theControl );
  27.         RectRgn( (RgnHandle) param, &(**theControl).contrlRect );
  28.         HUnlock( (Handle) theControl );
  29.     }
  30. }
  31.  
  32. #undef kPartMask